/*
 * SvrConfig.h
 *
 *  Created on: 2012-7-11
 *      Author: ThinkPad
 */

#ifndef SVRCONFIG_H_
#define SVRCONFIG_H_

#include "utils.h"

class SvrConfig
{
public:
  SvrConfig();
  ~SvrConfig();

  int init();
  int update();
  bool set_authsvr_address();

  int  listen_port;
  char listen_ip[32];

  char log_path[FILE_MAX_PATH];
  int  loglevel;

  char rootpath[FILE_MAX_PATH];
  char virtualpath[FILE_MAX_PATH];

  char pidfilepath[FILE_MAX_PATH];

  char Svr_Name[128];
  int  Svr_Id;
  char listenethname[16];

  char auth_ip[32];
  int auth_port;

  char limit_ip[32];
  char svr_key[128];

  int svr_max_connect_count;

protected:
  void init_config_path(void);
  int SavePid();

private:
  char  configpath[FILE_MAX_PATH];
  char  config_file[FILE_MAX_PATH];
  char  auth_host[FILE_MAX_PATH];
  char  str_buf[FILE_MAX_PATH];
};

#endif /* SVRCONFIG_H_ */
